extends ../components/base
block title
    title 应用管理
block aside_content
    include ../components/mixin
    -var routerObj = [{link:'/',text:'应用',icon:'icon-app'},{link:'/message',text:'消息',icon:'icon-message2'},{link:'/setting/user_manage',text:'平台管理',icon:'icon-setting'}]
    +asideNav(routerObj,2)
block common_header
    include ../components/header
    +commonheader(0)
block style
    link(rel='stylesheet', href=__CSS_PATH__ + '/news.css')
    style.
        #main-wrapper {
            margin-top: 10px;
        }
block main_content
    include ../components/mixin
    -var menuObj = [{link:'/setting/organization_manage',text:'平台自身管理'},{link:'/setting/contact_manage',text:'对接系统管理'},{link:'/setting/app_manage',text:'第三方应用系统管理'}]
    +menuLink(menuObj,1)
    -var navObj = [{link:'/setting/contact_manage',text:'应用管理'},{link:'/setting/contact_config',text:'应用权限配置'}]
    +menuNav(navObj,0)
    +RouteNav('应用管理')
    #inner-wrapper
        header.head-block
            .handle
                button.btn.btn-sm.btn-default(type='button' style='margin-right:20px' onclick="window.location.href='/setting/contact_addpage'") 添加
                button.btn.btn-sm.btn-default(type='button' style='margin-left:20px' onclick="window.location.href='/setting/contact_config'") 权限配置
        .content-list.section-block
            table.table.table-bordered
                thead
                    tr
                        td  中文名称
                        td  排序号
                        td  URL
                        td  应用描述
                        td  操作
                tbody
                    if(webLists.length)
                        each web in webLists
                            tr
                                td  #{web.name}
                                td  #{web.sortNum}
                                td  #{web.indexUrl}
                                td  #{web.descText}
                                td
                                    a.link(href='/setting/contact_edit?edit=true&id=' + web.id) 修改
                                    a.link.deleteContact(href='javascript:void(0);' data-id=web.id style='margin-left:20px;') 删除
block script
    script(type='text/javascript').
        function deleteContact(id) {
            $.post("/setting/contact_delete",{id:id},function (data) {
                if(data.code === 1){
                    window.location.reload();
                }else{
                    layerAlert("删除失败","error");
                }
            },'json')
        }
        $('.deleteContact').on('click',function (e) {
            var id = $(this).attr("data-id");
            if(id){
                layerAlert("确认删除吗?","confirm",deleteContact,id);
            }
        });
